package com.cskaoyan._07constructor._03invokeflow;

/**
 * @description:
 * @author: 景天
 * @date: 2023/2/4 11:32
 **/
/*
成员变量赋值方式:
1.默认赋值
2.显式赋值
3.构造器赋值


测试赋值顺序:
1.第一步永远是默认赋值
2.显式赋值
3.最后一步永远是构造器赋值
 */
public class Demo {
    public static void main(String[] args) {
        // 创建对象
        Student student = new Student("zs", 20);
        // 输出信息
        System.out.println("student.name = " + student.name);
        System.out.println("student.age = " + student.age);
    }
}

class Student{
    String name;
    // 显示赋值
    int age = 10;

    // 两参的构造方法
    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }
}